package ${packageName};


<#if useLomBok>
@lombok.Getter
@lombok.Setter
@lombok.ToString
@lombok.EqualsAndHashCode(callSuper = false)
</#if>
@${classAnno}
<#if superClass?has_content>
abstract class ${className} extends ${superClass}<${idType}> {
<#else>
public final class ${className} {
</#if>

<#list fields as field>
    <#if field.comment?has_content>
    /**
     * ${field.comment}
     */
    </#if>
    <#if field.delimiters?has_content>
    @${fieldAnno}(index = ${field.index}, name = "${field.name}", type = "${field.type}", delimiters = "${field.delimiters}")
    <#else>
    @${fieldAnno}(index = ${field.index}, name = "${field.name}", type = "${field.type}")
    </#if>
    <#if field.defaultValue?has_content>
    private ${field.declareType} ${field.name} = ${field.defaultValue};

    <#else>
    private ${field.declareType} ${field.name};

    </#if>
</#list>
    public ${className}() {

    }

<#if !useLomBok>
<#list fields as field>
    public ${field.declareType} get${field.upperName}() {
        return this.${field.name};
    }

    public ${className} set${field.upperName}(${field.declareType} ${field.name}) {
        this.${field.name} = ${field.name};
        return this;
    }

</#list>
    public String toString() {
        return "${className} {\n" +
<#list fields as field>
            "    ${field.name} = " + ${field.name} + "\n" +
</#list>
            "}";
    }

    @Override
    public int hashCode() {
        int result = 0;
    <#list fields as field>
        result = 31 * result + ${field.name}.hashCode();
    </#list>
        return result;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ${className} that = (${className}) o;
     <#list fields as field>
        if (!java.util.Objects.equals(${field.name}, that.${field.name})) {
            return false;
        }
    </#list>
        return true;
    }

</#if>
}
